<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>$compile_id</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="api.variables.html" title="Chapter 13. Smarty Class Variables">
<link rel="prev" href="variable.compile.dir.html" title="$compile_dir">
<link rel="next" href="variable.compile.locking.html" title="$compile_locking">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">$compile_id</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="variable.compile.dir.html">Prev</a> </td>
<th width="60%" align="center">Chapter 13. Smarty Class Variables</th>
<td width="20%" align="right"> <a accesskey="n" href="variable.compile.locking.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="$compile_id">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="variable.compile.id"></a>$compile_id</h2></div></div></div>
<p>
  Persistant compile identifier. As an alternative to passing the same
  <em class="parameter"><code>$compile_id</code></em> to each and every function call, you can set this
  <em class="parameter"><code>$compile_id</code></em> and it will be used implicitly thereafter.
 </p>
<p>
  With a <em class="parameter"><code>$compile_id</code></em> you can work around the limitation
  that you cannot use the same
  <a class="link" href="variable.compile.dir.html" title="$compile_dir"><em class="parameter"><code>$compile_dir</code></em></a>
  for different <a class="link" href="variable.template.dir.html" title="$template_dir">
  <em class="parameter"><code>$template_dirs</code></em></a>.  If you set a distinct
  <em class="parameter"><code>$compile_id</code></em> for each
  <a class="link" href="variable.template.dir.html" title="$template_dir"><em class="parameter"><code>$template_dir</code></em>
  </a> then Smarty can tell the compiled templates apart by their
  <em class="parameter"><code>$compile_id</code></em>.
 </p>
<p>
  If you have for example a
  <a class="link" href="plugins.prefilters.postfilters.html" title="Prefilters/Postfilters">prefilter</a>
  that localizes your templates
  (that is: translates language dependend parts) at compile time, then
  you could use the current language as <em class="parameter"><code>$compile_id</code></em> and
  you will get a  set of compiled templates for each language you use.
 </p>
<p>
  Another application would be to use the same compile directory across
  multiple domains / multiple virtual hosts.
 </p>
<div class="example">
<a name="id417617"></a><p class="title"><b>Example 13.1. $compile_id in a virtual host environment</b></p>
<div class="example-contents"><pre class="programlisting">

&lt;?php

$smarty-&gt;compile_id = $_SERVER['SERVER_NAME'];
$smarty-&gt;compile_dir = '/path/to/shared_compile_dir';

?&gt;

  </pre></div>
</div>
<br class="example-break">
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="variable.compile.dir.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="api.variables.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="variable.compile.locking.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">$compile_dir </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> $compile_locking</td>
</tr>
</table>
</div>
</body>
</html>
